VCC_MAJOR 		= 1
VCC_MINOR 		= 6
VCC_PATCH 		= 0
VCC_STR 		= -rc 

VCC_COMPILE_TIME 	= $(shell date)
VCC_COMPILE_BY 	= $(shell whoami)
VCC_SEMVER 		= vcc $(VCC_MAJOR).$(VCC_MINOR).$(VCC_PATCH)$(VCC_STR)

srcs 			= main.c vcc.c pretty.c cmd.c 
objs 			= main.o vcc.o pretty.o cmd.o 
target 			= vcc 
CFLAGS 			= -std=gnu11 -Wall -Wextra -Werror -Iinclude -g 
MAKEFLAGS 		= --no-print-directory

VCC_VERSION 		= VCC $(VCC_MAJOR).$(VCC_MINOR).$(VCC_PATCH) \
		  $(VCC_COMPILE_TIME) $(VCC_COMPILE_BY)

all : 
	@echo "$(VCC_VERSION)"
	@echo "$(VCC_SEMVER)"
	@echo "#define VCC_VERSION \"$(VCC_VERSION)\"" > include/vcc/version.h 
	@echo "#define VCC_SEMVER \"$(VCC_SEMVER)\"" >> include/vcc/version.h 
	@$(MAKE) $(target) $(MAKEFLAGS)

$(target) : 	$(objs) $(srcs)
	@$(CC) $(CFLAGS) $(objs) -o $(target)
	@echo -e "LD\t\t\t$(target)"

%.o : %.c
	@$(CC) -c $(CFLAGS) $*.c 
	@echo -e "CC\t\t\t$*.c"

.PHONY clean : 
	$(RM) $(objs) $(target) -f  

